package com.example.dao;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.mybatis.spring.SqlSessionTemplate;

/**
 * 基础DAO类，提供多业务数据库功能
 * 
 * @author AI Assistant
 * @since 2025-01-08
 */
public abstract class BaseDAO {

    @Autowired
    @Qualifier("userDbSqlSessionTemplate")
    protected SqlSessionTemplate userDbSqlSessionTemplate;

    @Autowired
    @Qualifier("orderDbSqlSessionTemplate")
    protected SqlSessionTemplate orderDbSqlSessionTemplate;

    @Autowired
    @Qualifier("logDbSqlSessionTemplate")
    protected SqlSessionTemplate logDbSqlSessionTemplate;

    /**
     * 获取用户业务数据库SqlSessionTemplate
     */
    protected SqlSessionTemplate getUserDbTemplate() {
        return userDbSqlSessionTemplate;
    }

    /**
     * 获取订单业务数据库SqlSessionTemplate
     */
    protected SqlSessionTemplate getOrderDbTemplate() {
        return orderDbSqlSessionTemplate;
    }

    /**
     * 获取日志业务数据库SqlSessionTemplate
     */
    protected SqlSessionTemplate getLogDbTemplate() {
        return logDbSqlSessionTemplate;
    }
}
